<template>
	<view class="saleOrder">
		<uni-nav-bar color="#ffffff" background-color="#00aded" :statusBar="true" title="销售订单" fixed="true" left-icon="left" left-text="返回" @clickLeft="back" />
		<view class="saleOrder_top">
			<!-- 搜索 -->
			<!-- 搜索 -->
			<dil-search :columnData="options.columnDataList" @onSearch="onSearch" v-if="options.columnDataList.length > 0"></dil-search>
		</view>
		<view class="saleOrder_main">
			<dil-card class="dilCard" @emitEvent="emitEvent" v-bind.sync="options"></dil-card>
		</view>
		<view class="saleOrder_floot"></view>
	</view>
</template>

<script>
import { mapState, mapMutations } from 'vuex';
export default {
	data() {
		return {
			options: {
				requestUrl: '/api/v1/ams/selectSaleOrderPage?apiId=632',
				requestQuery: {},
				cardSlotList: [
					{
						label: '制订通知单',
						value: 'addSaleRequirement',
						icon: 'wlIcon-xinzeng',
						emitEvent: 'addSaleRequirement'
					}
				],
				columnDataList: [],
				totalNum: 0
			}
		};
	},
	onShow() {
		uni.$emit('onShow', 1);
	},
	mounted() {},
	methods: {
		onSearch(item) {
			this.options.requestQuery = JSON.parse(JSON.stringify(item));
		},
		back() {
			uni.switchTab({
				url: '/pages/index/index'
			});
		},
		emitEvent(eventName, cardItem) {
			this[eventName](cardItem);
		},
		addSaleRequirement(item) {
			this.updateSaleOrderItem(item);
			uni.navigateTo({
				url: '/pages/transAppoint/saleAppointAdd'
			});
		},
		//以下是vuex;
		...mapMutations('sale', ['updateSaleOrderItem'])
	}
};
</script>

<style lang="scss" scoped>
.saleOrder {
	width: 100vw;
	height: 100%;
	background-color: #f5f5f5;
	&_top {
		background-color: #fff;
	}
	&_main {
	}
	&_floot {
		background-color: #fff;
	}
}
</style>
